<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="author" content="lijinbo" />
    <meta name="cdnload" content="compressor,vue,vue-preview" />
    <title>069-浏览器图片压缩</title>
    <style>
      img {
        max-width: 300px;
      }
    </style>
  </head>

  <body>
    <div id="app" class="box">
      <p>
        本案例使用 compressorjs 进行图片压缩 详细参考官方文档
        <a href="https://fengyuanchen.github.io/compressorjs/" target="_blank">compressorjs</a>
      </p>
      <div>
        文件：
        <input type="file" @change="selectFile" accept=".jpg, .png, .webp" />
        压缩级别：
        <input type="number" min="1" max="9" v-model="quality" placeholder="压缩级别" />
      </div>

      <p>压缩前大小: {{ size }}</p>
      <p>压缩后大小: {{ sizeMin }}</p>
      <hr />
      <p>使用场景：图片预览</p>
      <vue-preview :slides="slides"></vue-preview>
    </div>
    <script type="module" src="./069-main.js"></script>
  </body>
</html>
